Kinetis SDK Demo Applications User Guide  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
playsound.h File Reference
#include <stdint.h>
#include "fsl_soundcard.h"
#include "fsl_sgtl5000_driver.h"

Go to the source code of this file.

Data Structures

struct  wave_header_t
 
struct  wave_file_t
 

Macros

#define WAVE_FILE_HEADER_SIZE
 < brief standards Winodws PCM wave file header length More...
 

Typedefs

typedef uint32_t(* APP_GET_DATA_FUNC )(uint32_t NumBytesReq, uint8_t **ppDada, uint32_t offset)
 < More...
 

Functions

int PLAYSOUND_GetWaveFileInfo (uint8_t *pBuffer, wave_file_t *pWave)
 Decode wave file header, only support standard Windows PCM uncompressed file. More...
 
int PLAYSOUND_Play (APP_GET_DATA_FUNC fpAppGetData)
 Use sound card to play audio, need wave file data, only support standard Windows PCM uncompressed file. More...
 
void PLAYSOUND_Init (void)
 Init sound card. More...
 

Data Structure Documentation

struct wave_header_t
Data Fields
uint16_t bit_samp
uint16_t bitSamp
uint16_t block_align
uint16_t blockAlign
uint32_t byte_rate
uint32_t byteRate
uint16_t channels
uint8_t data_flag[4]
uint8_t dataFlag[4]
uint8_t fmt[4]
uint32_t fmt_len
uint32_t fmtLen
uint32_t length
uint8_t riff[4]
uint32_t samp_freq
uint32_t sampFreq
uint32_t size
uint16_t tag
uint8_t wave_flag[4]
uint8_t waveFlag[4]
struct wave_file_t
Data Fields
uint32_t * data
wave_header_t header
uint32_t * pData

Macro Definition Documentation

#define WAVE_FILE_HEADER_SIZE

Standard Windows PCM wave file header struct.

Typedef Documentation

typedef uint32_t(* APP_GET_DATA_FUNC)(uint32_t NumBytesReq, uint8_t **ppDada, uint32_t offset)

Get data callback functions Prototypes API funcions

Function Documentation

int PLAYSOUND_GetWaveFileInfo ( uint8_t *  pBuffer,
wave_file_t pWave 
)

This function decode Windows PCM wave file data and, if success, loaded file header information into struct instance.

Parameters
[in]pBufferPointer to a wave file start address.
[in]pWavePointer to a wave_file struct.
Returns
0:succ 1:fail
void PLAYSOUND_Init ( void  )

This function will initialize controller(K70's sai moudle) and decoder(SGTL5000) and config them with default values for play audio.

Note
8 bit is not supported in SGTL5000
int PLAYSOUND_Play ( APP_GET_DATA_FUNC  fpAppGetData)

Before calling this function, we must make sure PLAYSOUND_Init has alrady called. This function will play audio according to wave file data which acquired by a user callback function. Prototyoe of "GetData" function: uint32_t APP_GetData(uint32_t NumBtytesReq, uint8_t **ppData, uint32_t offset)

Parameters
[in]fpAppGetDataPointer to a function which is called by PLAYSOUND_Play routine for getting data.
Returns
0:succ 1:fail